#ifndef __CORE_UTILS_CI0PVMUJ
#define __CORE_UTILS_CI0PVMUJ

#include "cms_msg.h"


#define DEBUG_LOG 0

typedef struct cms_moduleInfo_s{
	uint32_t pid;
	uint32_t moduleMsqId;
	uint32_t eventMsqId;
	char moduleName[MODULE_NAME_SIZE];
}cms_moduleInfo_t;

typedef struct cms_hookModuleList_s{
	struct cms_hookModuleList_s *prev;
	struct cms_hookModuleList_s *next;
	struct cms_moduleInfo_s moduleInfo;
}cms_hookModuleList_t;

typedef struct cms_event_s{
	uint32_t eventID;
	struct cms_hookModuleList_s *moduleListOfEvent;
}cms_event_t;

typedef struct cms_hookEventList_s{
	struct cms_hookEventList_s *prev;
	struct cms_hookEventList_s *next;
	uint32_t eventID;
}cms_hookEventList_t;

typedef struct cms_module_s{
	struct cms_moduleInfo_s moduleInfo;
	struct cms_hookEventList_s *eventListOfModule;
}cms_module_t;

typedef struct cms_moduleList_s{
	struct cms_moduleList_s *prev;
	struct cms_moduleList_s *next;
	struct cms_module_s	*module;
}cms_moduleList_t;

typedef struct cms_eventList_s{
	struct cms_eventList_s *prev;
	struct cms_eventList_s *next;
	struct cms_event_s *event;
}cms_eventList_t;

int cmsCore_unSubscribeEvent(event_t *event, int moduleMsqId);
int cmsCore_subscribeEvent(event_t *event, int moduleMsqId);
int cmsCore_unregModule(const cmsMsg_action_t *pAction);
int cmsCore_regModule(const cmsMsg_action_t *pAction);
int cmsCore_notify(cmsMsgCb_t *pMsg);
int cmsCore_forwardMsg(cmsMsgCb_t *pMsg, uint32_t dtsId);

cms_moduleList_t *cmsCore_seekModuleByName(char *moduleName);
void cmsCore_printModuleList(void);
void cmsCore_printEventList(void);
void cmsCore_printEvent(char *moduleName);


#endif /* end of include guard: __CORE_UTILS_CI0PVMUJ */
